package com.colbby.datahouse.transform;

import com.colbby.datahouse.utils.CastUtils;
import com.colbby.datahouse.utils.TypeDescriptor;
import com.colbby.datahouse.utils.TypeUtils;

public class ShortTransformer implements DataTypeTransform<Short> {

	public static final ShortTransformer INSTANCE = new ShortTransformer();
	
	@Override
	public Short transform(TypeDescriptor returnType, Object value) {
		return CastUtils.castToShort(CastUtils.getValue(value));
	}

	@Override
	public boolean shouldDo(TypeDescriptor returnType, Object value) {
		return TypeUtils.isSuperClass(Short.class, returnType.getTypeClass());
	}
}